﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using BaMusaSoft.RPS.ViewModel;
using System.Windows.Media;
using System.Windows.Data;

namespace BaMusaSoft.RPS.View.Services
{
    public class AllSchedulesTemplateSelector:DataTemplateSelector
    {
        UserControl currentView;
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {

            //SetCurrentView(container);
            //var vm = currentView.DataContext as AllSchedulesViewModel;
            //if (vm != null)
            //{
            //    switch (vm.CurrentShow)
            //    {
            //        case "Customers":
            //            return currentView.FindResource("SchedulesView_Customers") as DataTemplate;
            //        case "Contracts":
            //            return currentView.FindResource("SchedulesView_Contracts") as DataTemplate;
            //        case "Details":
            //            return currentView.FindResource("SchedulesView_Details") as DataTemplate;
            //        default:
            //            return currentView.FindResource("SchedulesView_Customers") as DataTemplate;

            //    }
            //}

                   

       
            return null;
        }
        void SetCurrentView(DependencyObject container)
        {
            var s = VisualTreeHelper.GetParent(container);
            var view = s as UserControl;
            if (view != null)
            {
                currentView = view;
            }
            else
            {
                SetCurrentView(s);
            }


        }
       
    }
}
